<template>
  <div class="main">
    <p  class="main_text">审核列表</p>
    <!-- ############################################## 表单 ############################################## -->
    <div class="cyr-flex">
      <el-tabs v-model="activeName" class="demo-tabs" @tab-click="handleClick">
        <el-tab-pane label="待处理" name="first">
          <el-table  :data="tableData"  :header-cell-style="{ background: '#f0f6fe' }" v-adaptive :show-overflow-tooltip="true" border >
            <el-table-column label="任务名" prop="任务名">
              <template #default="props">
                <el-text tag="span" style="cursor: pointer" @click="auditData(props.row)">{{
                  props.row.任务名
                }}</el-text>
              </template>
            </el-table-column>
            <el-table-column label="任务类型" prop="任务类型" />
            <el-table-column label="待办人" prop="待办人" />
            <el-table-column label="发起时间" prop="发起时间" />
            <el-table-column label="操作" fixed="right" width="100">
              <template #default="props">
                <!-- <el-button size="small" link type="primary" @click="checkDataList(props.row)">查看</el-button> -->
                <el-button size="small" link type="primary" @click="auditData(props.row)"
                  v-if="roleList.read">审核详情</el-button>
              </template>
            </el-table-column>
          </el-table>
          <!-- 分页器 -->
          <smartPager v-model:current-page="currentPage" v-model:page-size="pageSize" :total="total"
            @change="handleCurrentChange" />
          <!-- ############################################## 蒙层 ############################################## -->
          <!-- ****************************** 提交审核 ****************************** -->
          <el-drawer v-model="checkcenterDialogVisible" :with-header="false" size="40%" @close="closeDialog">
            <div style="color: #3d3d3d; font-size: 20px; font-weight: bold">
              {{ auditFormData.任务类型 }}&nbsp;&nbsp;&nbsp;<span class="id">编号：{{ auditFormData.任务id }}</span>
            </div>
            <el-form :model="auditFormData" label-width="120px" labe-position="left" style="padding-top: 40px"
              class="df fww jcsb">
              <el-form-item label="任务名：" class="df aic jcsb" style="width: 50%">
                <el-icon class="icon_i" color="#D8D8D8">
                  <Edit />
                </el-icon>
                <el-text>{{ auditFormData.任务名 }}</el-text>
              </el-form-item>
              <el-form-item label="任务类型：" class="df aic jcsb" style="width: 50%">
                <el-icon class="icon_i" color="#D8D8D8">
                  <Edit />
                </el-icon>
                <el-text>{{ auditFormData.任务类型 }}</el-text>
              </el-form-item>
              <el-form-item label="待办人：" class="df aic jcsb" style="width: 50%">
                <el-icon class="icon_i" color="#D8D8D8">
                  <Edit />
                </el-icon>
                <el-text>{{ auditFormData.待办人 }}</el-text>
              </el-form-item>
              <el-form-item label="发起人：" class="df aic jcsb" style="width: 50%">
                <el-icon class="icon_i" color="#D8D8D8">
                  <Edit />
                </el-icon>
                <el-text>{{ PutInName }}</el-text>
              </el-form-item>
              <el-form-item label="材料类型：" class="df aic jcsb" style="width: 50%" v-if="
                auditFormData.任务类型 != '司机申述' &&
                auditFormData.任务类型 != '结算单审核' &&
                auditFormData.任务类型 != '财务结算审核'
              ">
                <el-icon class="icon_i" color="#D8D8D8">
                  <Edit />
                </el-icon>
                <el-text v-if="contentType == 0">原材料</el-text>
                <el-text v-else-if="contentType == 1">溯源件</el-text>
                <el-text v-else-if="contentType == 2">危固废</el-text>
                <el-text v-else>非溯源件</el-text>
              </el-form-item>
              <el-form-item v-if="contentType == 2 && auditFormData.任务类型 == '出库审核'" label="转运联单：" class="df aic jcsb"
                style="width: 50%">
                <el-icon class="icon_i" color="#D8D8D8">
                  <Edit />
                </el-icon>
                <img style="width: 100px; height: 100px" :src="transportBill" alt="" @click="previewImg" />
              </el-form-item>
            </el-form>
            <!-- ****************** 入库审核 ****************** -->
            <div v-if="auditFormData.任务类型 == '入库审核'">
              <!-- ********** 原材料 ********* -->
              <el-table :data="putIntableData" style="width: 100%" class="mt20" v-if="contentType == 0"
                :header-cell-style="{ background: '#f5f7fa' }" border max-height="240">
                <el-table-column label="编号" prop="content.rawMaterialId" :show-overflow-tooltip="true" />
                <el-table-column label="名称" prop="content.rawMaterialName" :show-overflow-tooltip="true" />
                <el-table-column label="类型" prop="content.typeName" :show-overflow-tooltip="true" />
                <el-table-column label="仓库" prop="content.warehouseName" :show-overflow-tooltip="true" />
                <el-table-column label="区域" prop="content.warehouseArea" :show-overflow-tooltip="true" />
                <el-table-column label="数量" prop="num" :show-overflow-tooltip="true" />
                <!-- <el-table-column label="备注" prop="content.rawMaterialDescription"
                                    :show-overflow-tooltip="true" /> -->
              </el-table>
              <!-- ********** 溯源件 ********* -->
              <el-table :data="putIntableData" style="width: 100%" class="mt20" v-else-if="contentType == 1"
                :header-cell-style="{ background: '#f5f7fa' }" border max-height="240">
                <el-table-column label="编号" prop="content.fittingId" :show-overflow-tooltip="true" />
                <el-table-column label="溯源件" prop="content.fittingName" :show-overflow-tooltip="true" />
                <el-table-column label="仓库" prop="content.warehouseName" :show-overflow-tooltip="true" />
                <el-table-column label="区域" prop="content.warehouseArea" :show-overflow-tooltip="true" />
                <el-table-column label="品牌" prop="content.brand" :show-overflow-tooltip="true" />
                <el-table-column label="车系" prop="content.series" :show-overflow-tooltip="true" />
                <el-table-column label="车型" prop="content.modelName" :show-overflow-tooltip="true" />
                <!-- <el-table-column label="备注" prop="content.fittingDescription"
                                    :show-overflow-tooltip="true" /> -->
              </el-table>
              <!-- ********** 危固废 ********* -->
              <el-table :data="putIntableData" style="width: 100%" class="mt20" v-else-if="contentType == 2"
                :header-cell-style="{ background: '#f5f7fa' }" border max-height="240">
                <el-table-column label="编号" prop="content.hazardousWasteId" :show-overflow-tooltip="true" />
                <el-table-column label="名称" prop="content.hazardousWasteName" :show-overflow-tooltip="true" />
                <el-table-column label="类型" prop="content.typeName" :show-overflow-tooltip="true" />
                <el-table-column label="仓库" prop="content.warehouseName" :show-overflow-tooltip="true" />
                <el-table-column label="区域" prop="content.warehouseArea" :show-overflow-tooltip="true" />
                <el-table-column label="数量" prop="num" :show-overflow-tooltip="true" />
                <!-- <el-table-column label="备注" prop="content.remark" :show-overflow-tooltip="true" /> -->
              </el-table>
              <!-- ********** 非溯源件 ********* -->
              <el-table :data="putIntableData" style="width: 100%" class="mt20" v-else
                :header-cell-style="{ background: '#f5f7fa' }" border max-height="240">
                <el-table-column label="编号" prop="content.partsId" :show-overflow-tooltip="true" />
                <el-table-column label="非溯源件名" prop="content.partsName" :show-overflow-tooltip="true" />
                <el-table-column label="类型" prop="content.typeName" :show-overflow-tooltip="true" />
                <el-table-column label="仓库" prop="content.warehouseName" :show-overflow-tooltip="true" />
                <el-table-column label="区域" prop="content.warehouseArea" :show-overflow-tooltip="true" />
                <el-table-column label="数量" prop="num" :show-overflow-tooltip="true" />
                <!-- <el-table-column label="价格" prop="content.price" :show-overflow-tooltip="true" /> -->
                <!-- <el-table-column label="备注" prop="content.partsDescription" :show-overflow-tooltip="true" /> -->
              </el-table>
            </div>
            <!-- ****************** 出库审核 ****************** -->
            <div v-if="auditFormData.任务类型 == '出库审核'">
              <!-- ********** 原材料 ********* -->
              <el-table :data="outBonudTableData" style="width: 100%" class="mt20" v-if="contentType == 0"
                :header-cell-style="{ background: '#f5f7fa' }" border max-height="240">
                <el-table-column label="编号" prop="content.rawMaterialId" :show-overflow-tooltip="true" />
                <el-table-column label="名称" prop="content.rawMaterialName" :show-overflow-tooltip="true" />
                <el-table-column label="类型" prop="content.typeName" :show-overflow-tooltip="true" />
                <el-table-column label="仓库" prop="content.warehouseName" :show-overflow-tooltip="true" />
                <el-table-column label="区域" prop="content.warehouseArea" :show-overflow-tooltip="true" />
                <el-table-column label="出库数量" prop="num" :show-overflow-tooltip="true" min-width="90" />
                <!-- <el-table-column label="备注" prop="content.rawMaterialDescription"
                                    :show-overflow-tooltip="true" /> -->
              </el-table>
              <!-- ********** 溯源件 ********* -->
              <el-table :data="outBonudTableData" style="width: 100%" class="mt20" v-else-if="contentType == 1"
                :header-cell-style="{ background: '#f5f7fa' }" border max-height="240">
                <el-table-column label="编号" prop="content.fittingId" :show-overflow-tooltip="true" />
                <el-table-column label="溯源件" prop="content.fittingName" :show-overflow-tooltip="true" />
                <el-table-column label="仓库" prop="content.warehouseName" :show-overflow-tooltip="true" />
                <el-table-column label="区域" prop="content.warehouseArea" :show-overflow-tooltip="true" />
                <el-table-column label="品牌" prop="content.brand" :show-overflow-tooltip="true" />
                <el-table-column label="车系" prop="content.series" :show-overflow-tooltip="true" />
                <el-table-column label="车型" prop="content.modelName" :show-overflow-tooltip="true" />
                <!-- <el-table-column label="备注" prop="content.fittingDescription"
                                    :show-overflow-tooltip="true" /> -->
              </el-table>
              <!-- ********** 危固废 ********* -->
              <el-table :data="outBonudTableData" style="width: 100%" class="mt20" v-else-if="contentType == 2"
                :header-cell-style="{ background: '#f5f7fa' }" border max-height="240">
                <el-table-column label="编号" prop="content.hazardousWasteId" :show-overflow-tooltip="true" />
                <el-table-column label="名称" prop="content.hazardousWasteName" :show-overflow-tooltip="true" />
                <el-table-column label="类型" prop="content.typeName" :show-overflow-tooltip="true" />
                <el-table-column label="仓库" prop="content.warehouseName" :show-overflow-tooltip="true" />
                <el-table-column label="区域" prop="content.warehouseArea" :show-overflow-tooltip="true" />
                <el-table-column label="数量" prop="num" :show-overflow-tooltip="true" />
                <!-- <el-table-column label="备注" prop="content.remark" :show-overflow-tooltip="true" /> -->
              </el-table>
              <!-- ********** 非溯源件 ********* -->
              <el-table :data="outBonudTableData" style="width: 100%" class="mt20" v-else
                :header-cell-style="{ background: '#f5f7fa' }" border max-height="240">
                <el-table-column label="编号" prop="content.partsId" :show-overflow-tooltip="true" />
                <el-table-column label="非溯源件名" prop="content.partsName" :show-overflow-tooltip="true" />
                <el-table-column label="类型" prop="content.typeName" :show-overflow-tooltip="true" />
                <el-table-column label="仓库" prop="content.warehouseName" :show-overflow-tooltip="true" />
                <el-table-column label="区域" prop="content.warehouseArea" :show-overflow-tooltip="true" />
                <el-table-column label="数量" prop="num" :show-overflow-tooltip="true" />
                <!-- <el-table-column label="价格" prop="content.price" :show-overflow-tooltip="true" /> -->
                <!-- <el-table-column label="备注" prop="content.partsDescription" :show-overflow-tooltip="true" /> -->
              </el-table>
            </div>
            <!-- ****************** 调拨审核 ****************** -->
            <div v-if="auditFormData.任务类型 == '调拨审核'">
              <!-- ********** 原材料 ********* -->
              <el-form :model="allotFormData" label-width="100px" label-position="left" v-if="contentType == 0">
                <el-form-item label="调拨编号：">
                  <el-text>{{ allotFormData.transferId }}</el-text>
                </el-form-item>
                <el-form-item label="调出仓库：">
                  <el-text>{{ allotFormData.outWarehouse }}</el-text>
                </el-form-item>
                <el-form-item label="调入仓库：">
                  <el-text>{{ allotFormData.inWarehouse }}</el-text>
                </el-form-item>
                <el-form-item label="调拨类型：">
                  <el-text>{{ allotFormData.type_name }}</el-text>
                </el-form-item>
                <el-form-item label="调拨数量：">
                  <el-text>{{ allotFormData.num }}</el-text>
                </el-form-item>
              </el-form>
              <!-- ********** 溯源件 ********* -->
              <el-form :model="allotFormData" label-width="100px" labe-position="left" class="df fww jcsb"
                label-position="left" v-else-if="contentType == 1">
                <el-form-item label="调拨编号：" style="width: 50%" class="df aic jcsb">
                  <el-text>{{ allotFormData.transferId }}</el-text>
                </el-form-item>
                <el-form-item label="调出仓库：" style="width: 50%" class="df aic jcsb">
                  <el-text>{{ allotFormData.outWarehouse }}</el-text>
                </el-form-item>
                <el-form-item label="调入仓库：" style="width: 50%" class="df aic jcsb">
                  <el-text>{{ allotFormData.inWarehouse }}</el-text>
                </el-form-item>
              </el-form>
              <el-table v-if="contentType == 1" :data="recordsTableData" size="small" style="width: 100%"
                :header-cell-style="{ background: '#ebeef5' }" border>
                <el-table-column label="配件编号" prop="fittingId" show-overflow-tooltip />
                <el-table-column label="配件名称" prop="fittingName" show-overflow-tooltip />
                <el-table-column label="品牌" prop="brand" show-overflow-tooltip />
                <el-table-column label="车型" prop="modelName" show-overflow-tooltip />
                <el-table-column label="车系" prop="series" show-overflow-tooltip />
                <el-table-column label="仓库位置" prop="warehouseArea" show-overflow-tooltip />
              </el-table>
              <!-- ********** 危固废 ********* -->
              <el-form :model="allotFormData" label-width="100px" label-position="left" v-else-if="contentType == 2">
                <el-form-item label="调拨编号：">
                  <el-text>{{ allotFormData.transferId }}</el-text>
                </el-form-item>
                <el-form-item label="调拨类型：">
                  <el-text>{{ allotFormData.typeName }}</el-text>
                </el-form-item>
                <el-form-item label="调出仓库：">
                  <el-text>{{ allotFormData.outWarehouse }}</el-text>
                </el-form-item>
                <el-form-item label="调入仓库：">
                  <el-text>{{ allotFormData.inWarehouse }}</el-text>
                </el-form-item>
                <el-form-item label="调拨数量：">
                  <el-text>{{ allotFormData.num }}</el-text>
                </el-form-item>
              </el-form>
              <!-- ********** 非溯源件 ********* -->
              <el-form :model="allotFormData" label-width="100px" label-position="left" v-else-if="contentType == 3">
                <el-form-item label="调拨编号：">
                  <el-text>{{ allotFormData.transferId }}</el-text>
                </el-form-item>
                <el-form-item label="调出仓库：">
                  <el-text>{{ allotFormData.outWarehouse }}</el-text>
                </el-form-item>
                <el-form-item label="调入仓库：">
                  <el-text>{{ allotFormData.inWarehouse }}</el-text>
                </el-form-item>
                <el-form-item label="调拨数量：">
                  <el-text>{{ allotFormData.num }}</el-text>
                </el-form-item>
              </el-form>
            </div>
            <!-- ****************** 结算单审核 ****************** -->
            <div v-if="auditFormData.任务类型 == '结算单审核'">
              <el-form :model="settleFormData" label-width="140px" label-position="left">
                <el-form-item label="车牌号：">
                  <el-text>{{ settleFormData.号牌号码 }}</el-text>
                </el-form-item>
                <el-form-item label="车辆净重(kg)：">
                  <el-text>{{ settleFormData.车辆净重 }}</el-text>
                </el-form-item>
                <el-form-item label="订单号：">
                  <el-text>{{ settleFormData.orderSn }}</el-text>
                </el-form-item>
                <el-form-item label="单价(元)：" v-if="misspartsDeductionFlag">
                  <el-text>{{ settleFormData.unitPrice }}</el-text>
                </el-form-item>
                <el-form-item label="扣杂系数：" v-if="misspartsDeductionFlag">
                  <el-text>{{ settleFormData.扣杂系数 }}</el-text>
                </el-form-item>
                <el-form-item label="缺件扣款(元)：" v-if="misspartsDeductionFlag">
                  <el-text>{{ settleFormData.missingPartsDeducted }}</el-text>
                </el-form-item>
                <el-form-item label="溢价金额(元)：" v-if="misspartsDeductionFlag">
                  <el-text>{{ settleFormData.premium }}</el-text>
                </el-form-item>
                <el-form-item label="运费补贴(元)：" v-if="misspartsDeductionFlag">
                  <el-text>{{ settleFormData.primage }}</el-text>
                </el-form-item>
                <el-form-item label="税率(‰)：">
                  <el-text>{{ settleFormData.taxRate }}</el-text>
                </el-form-item>
                <el-form-item label="预扣个税(元)：">
                  <el-text>{{ settleFormData.tax }}</el-text>
                </el-form-item>
                <el-form-item label="一口价(元)：" v-if="!misspartsDeductionFlag">
                  <el-text>{{ settleFormData.price }}</el-text>
                </el-form-item>
                <el-form-item label="价款合计(元)：" v-if="misspartsDeductionFlag">
                  <el-text>{{ settleFormData.price }}</el-text>
                </el-form-item>
                <el-form-item label="最终结算价(元)：" v-if="misspartsDeductionFlag">
                  <el-text>{{ settleFormData.finalPrice }}</el-text>
                </el-form-item>
                <el-form-item label="收款人：">
                  <el-text>{{ settleFormData.收款人 }}</el-text>
                </el-form-item>
              </el-form>
            </div>
            <!-- ****************** 财务结算审核 ****************** -->
            <div v-if="auditFormData.任务类型 == '财务结算审核'">
              <el-form :model="settleFormData" label-width="140px" label-position="left">
                <el-form-item label="车牌号：">
                  <el-text>{{ settleFormData.号牌号码 }}</el-text>
                </el-form-item>
                <el-form-item label="车辆净重(kg)：">
                  <el-text>{{ settleFormData.车辆净重 }}</el-text>
                </el-form-item>
                <el-form-item label="订单号：">
                  <el-text>{{ settleFormData.orderSn }}</el-text>
                </el-form-item>
                <el-form-item label="单价(元)：" v-if="misspartsDeductionFlag">
                  <el-text>{{ settleFormData.unitPrice }}</el-text>
                </el-form-item>
                <el-form-item label="扣杂系数：" v-if="misspartsDeductionFlag">
                  <el-text>{{ settleFormData.扣杂系数 }}</el-text>
                </el-form-item>
                <el-form-item label="缺件扣款(元)：" v-if="misspartsDeductionFlag">
                  <el-text>{{ settleFormData.missingPartsDeducted }}</el-text>
                </el-form-item>
                <el-form-item label="溢价金额(元)：" v-if="misspartsDeductionFlag">
                  <el-text>{{ settleFormData.premium }}</el-text>
                </el-form-item>
                <el-form-item label="运费补贴(元)：" v-if="misspartsDeductionFlag">
                  <el-text>{{ settleFormData.primage }}</el-text>
                </el-form-item>
                <el-form-item label="税率(‰)：">
                  <el-text>{{ settleFormData.taxRate }}</el-text>
                </el-form-item>
                <el-form-item label="预扣个税(元)：">
                  <el-text>{{ settleFormData.tax }}</el-text>
                </el-form-item>
                <el-form-item label="一口价(元)：" v-if="!misspartsDeductionFlag">
                  <el-text>{{ settleFormData.price }}</el-text>
                </el-form-item>
                <el-form-item label="价款合计(元)：" v-if="misspartsDeductionFlag">
                  <el-text>{{ settleFormData.price }}</el-text>
                </el-form-item>
                <el-form-item label="最终结算价(元)：" v-if="misspartsDeductionFlag">
                  <el-text>{{ settleFormData.finalPrice }}</el-text>
                </el-form-item>
                <el-form-item label="收款人：">
                  <el-text>{{ settleFormData.收款人 }}</el-text>
                </el-form-item>
              </el-form>
            </div>
            <!-- ****************** 司机申述 ****************** -->
            <div v-if="auditFormData.任务类型 == '司机申述'">
              <el-table :data="auditDetailData" style="width: 100%" class="mt20"
                :header-cell-style="{ background: '#f5f7fa' }" border max-height="240">
                <el-table-column label="序号" prop="updatedAt" :show-overflow-tooltip="true" />
                <el-table-column label="司机申述" prop="warehouseName" :show-overflow-tooltip="true" />
              </el-table>
            </div>
            <!-- ****************************** 审核流程 ****************************** -->
            <div style="margin-top: 30px">
              <div class="df aic">
                <div class="black_box">{{ PutInName }}</div>
                <div>
                  <p>{{ PutInName }}&nbsp;&nbsp;&nbsp;发起</p>
                  <p style="font-size: 12px; color: #999; margin-top: 4px" v-if="contentType == 0">原材料</p>
                  <p style="font-size: 12px; color: #999; margin-top: 4px" v-else-if="contentType == 1">溯源件</p>
                  <p style="font-size: 12px; color: #999; margin-top: 4px" v-else-if="contentType == 2">危固废</p>
                  <p style="font-size: 12px; color: #999; margin-top: 4px" v-else-if="contentType == 3">非溯源件</p>
                </div>
              </div>
              <div class="black_b" style="height: 60px">
                <div style="width: 2px; height: 40px; background-color: #eee"></div>
              </div>
              <!-- 审批人 -->
              <div v-for="(item, index) in carbonArr" :key="index">
                <div class="df aic">
                  <div class="black_box">{{ item.执行人 }}</div>
                  <div class="df aic">
                    <div>
                      <p>{{ item.执行人 }}</p>
                      <p style="font-size: 12px; color: #999; margin-top: 4px">{{ item.任务名 }}</p>
                    </div>
                    <img v-if="item.签名" style="width: 100px; height: 38px" class="ml20" :src="item.签名" alt="" />
                  </div>
                </div>
                <div class="black_b" style="height: 30px">
                  <div style="width: 2px; height: 30px; background-color: #409ffa"></div>
                </div>
              </div>
              <div class="df aic">
                <div class="black_box">抄</div>
                <div>
                  <p>抄送人</p>
                  <p style="font-size: 12px; color: #999; margin-top: 4px">已抄送 {{ approverLength }} 人</p>
                </div>
              </div>
              <div class="df">
                <div style="width: 50px"></div>
                <div class="df aic mt10">
                  <div style="text-align: center; margin-right: 6px" class="df fww fdc aic" v-for="item in approverArr"
                    :key="item">
                    <div class="black_boxx">{{ item }}</div>
                    <p style="font-size: 12px; color: #999; font-weight: 200; margin-top: 4px">{{ item }}</p>
                  </div>
                </div>
              </div>
            </div>

            <template #footer>
              <el-button type="primary" plain @click="rejectAudit">拒绝</el-button>
              <el-button type="primary" @click="submitAudit">&nbsp;通过&nbsp;</el-button>
            </template>
          </el-drawer>
        </el-tab-pane>
        <el-tab-pane label="已完成" name="second">
          <el-table  :data="tableData"  :header-cell-style="{ background: '#f0f6fe' }" v-adaptive :show-overflow-tooltip="true" border>
            <el-table-column label="任务名" prop="name" />
            <el-table-column label="任务类型" prop="tenantId" />
            <el-table-column label="审核结果">
              <template #default="props">
                <el-tag v-if="props.row.deleteReason" type="danger">已拒绝</el-tag>
                <el-tag v-else>已通过</el-tag>
              </template>
            </el-table-column>
            <el-table-column label="操作" fixed="right" width="100">
              <template #default="props">
                <!-- <el-button size="small" link type="primary" @click="checkDataList(props.row)">查看</el-button> -->
                <el-button size="small" link type="primary" @click="auditData1(props.row)">审核详情</el-button>
              </template>
            </el-table-column>
          </el-table>
          <!-- 分页器 -->
          <smartPager v-model:current-page="currentPage1" v-model:page-size="pageSize1" :total="total1"
            @change="handleSizeChange1" />
          <!-- ############################################## 蒙层 ############################################## -->
          <!-- ****************************** 提交审核 ****************************** -->
          <el-drawer v-model="checkcenterDialogVisible1" :with-header="false" size="40%" @close="closeDialog">
            <div style="color: #3d3d3d; font-size: 20px; font-weight: bold">
              {{ auditFormData.tenantId }}&nbsp;&nbsp;&nbsp;<span class="id">编号：{{ auditFormData.id }}</span>
            </div>
            <el-form :model="auditFormData" label-width="120px" labe-position="left" style="padding-top: 40px"
              class="df fww jcsb">
              <el-form-item label="任务名：" class="df aic jcsb" style="width: 50%">
                <el-icon class="icon_i" color="#D8D8D8">
                  <Edit />
                </el-icon>
                <el-text>{{ auditFormData.name }}</el-text>
              </el-form-item>
              <el-form-item label="任务类型：" class="df aic jcsb" style="width: 50%">
                <el-icon class="icon_i" color="#D8D8D8">
                  <Edit />
                </el-icon>
                <el-text>{{ auditFormData.tenantId }}</el-text>
              </el-form-item>
              <!-- <el-form-item label="待办人：" class="df aic jcsb" style="width: 50%;">
                                <el-icon class="icon_i" color="#D8D8D8">
                                    <Edit />
                                </el-icon>
                                <el-text>{{ auditFormData.assignee }}</el-text>
                            </el-form-item> -->
              <el-form-item label="发起人：" class="df aic jcsb" style="width: 50%">
                <el-icon class="icon_i" color="#D8D8D8">
                  <Edit />
                </el-icon>
                <el-text>{{ PutInName }}</el-text>
              </el-form-item>
              <el-form-item label="材料类型：" class="df aic jcsb" style="width: 50%" v-if="
                auditFormData.tenantId != '司机申述' &&
                auditFormData.tenantId != '结算单审核' &&
                auditFormData.tenantId != '财务结算审核'
              ">
                <el-icon class="icon_i" color="#D8D8D8">
                  <Edit />
                </el-icon>
                <el-text v-if="contentType == 0">原材料</el-text>
                <el-text v-else-if="contentType == 1">溯源件</el-text>
                <el-text v-else-if="contentType == 2">危固废</el-text>
                <el-text v-else-if="contentType == 3">非溯源件</el-text>
              </el-form-item>
              <el-form-item v-if="contentType == 2 && auditFormData.tenantId == '出库审核'" label="转运联单："
                class="df aic jcsb" style="width: 50%">
                <el-icon class="icon_i" color="#D8D8D8">
                  <Edit />
                </el-icon>
                <img style="width: 100px; height: 100px" :src="transportBill" alt="" @click="previewImg" />
              </el-form-item>
              <el-form-item label="审核结果：" class="df aic jcsb" style="width: 50%">
                <el-icon class="icon_i" color="#D8D8D8">
                  <Edit />
                </el-icon>
                <el-tag v-if="auditResult.auditResult == 1" type="danger">拒绝</el-tag>
                <el-tag v-else>通过</el-tag>
              </el-form-item>
              <el-form-item label="拒绝原因：" class="df aic jcsb" style="width: 100%" v-if="auditResult.auditResult == 1">
                <el-icon class="icon_i" color="#D8D8D8">
                  <Edit />
                </el-icon>
                <el-input type="textarea" v-model="auditResult.rejectReason" style="width: 100%" disabled />
              </el-form-item>
            </el-form>
            <!-- ****************** 入库审核 ****************** -->
            <div v-if="auditFormData.tenantId == '入库审核'">
              <!-- ********** 原材料 ********* -->
              <el-table :data="putIntableData" style="width: 100%" class="mt20" v-if="contentType == 0"
                :header-cell-style="{ background: '#f5f7fa' }" border max-height="240">
                <el-table-column label="编号" prop="content.rawMaterialId" :show-overflow-tooltip="true" />
                <el-table-column label="名称" prop="content.rawMaterialName" :show-overflow-tooltip="true" />
                <el-table-column label="类型" prop="content.typeName" :show-overflow-tooltip="true" />
                <el-table-column label="仓库" prop="content.warehouseName" :show-overflow-tooltip="true" />
                <el-table-column label="区域" prop="content.warehouseArea" :show-overflow-tooltip="true" />
                <el-table-column label="数量" prop="num" :show-overflow-tooltip="true" />
                <!-- <el-table-column label="备注" prop="content.rawMaterialDescription"
                                    :show-overflow-tooltip="true" /> -->
              </el-table>
              <!-- ********** 溯源件 ********* -->
              <el-table :data="putIntableData" style="width: 100%" class="mt20" v-else-if="contentType == 1"
                :header-cell-style="{ background: '#f5f7fa' }" border max-height="240">
                <el-table-column label="编号" prop="content.fittingId" :show-overflow-tooltip="true" />
                <el-table-column label="溯源件" prop="content.fittingName" :show-overflow-tooltip="true" />
                <el-table-column label="仓库" prop="content.warehouseName" :show-overflow-tooltip="true" />
                <el-table-column label="区域" prop="content.warehouseArea" :show-overflow-tooltip="true" />
                <el-table-column label="品牌" prop="content.brand" :show-overflow-tooltip="true" />
                <el-table-column label="车系" prop="content.series" :show-overflow-tooltip="true" />
                <el-table-column label="车型" prop="content.modelName" :show-overflow-tooltip="true" />
                <!-- <el-table-column label="备注" prop="content.fittingDescription"
                                    :show-overflow-tooltip="true" /> -->
              </el-table>
              <!-- ********** 危固废 ********* -->
              <el-table :data="putIntableData" style="width: 100%" class="mt20" v-else-if="contentType == 2"
                :header-cell-style="{ background: '#f5f7fa' }" border max-height="240">
                <el-table-column label="编号" prop="content.hazardousWasteId" :show-overflow-tooltip="true" />
                <el-table-column label="名称" prop="content.hazardousWasteName" :show-overflow-tooltip="true" />
                <el-table-column label="类型" prop="content.typeName" :show-overflow-tooltip="true" />
                <el-table-column label="仓库" prop="content.warehouseName" :show-overflow-tooltip="true" />
                <el-table-column label="区域" prop="content.warehouseArea" :show-overflow-tooltip="true" />
                <el-table-column label="数量" prop="num" :show-overflow-tooltip="true" />
                <!-- <el-table-column label="备注" prop="content.remark" :show-overflow-tooltip="true" /> -->
              </el-table>
              <!-- ********** 非溯源件 ********* -->
              <el-table :data="putIntableData" style="width: 100%" class="mt20" v-else
                :header-cell-style="{ background: '#f5f7fa' }" border max-height="240">
                <el-table-column label="编号" prop="content.partsId" :show-overflow-tooltip="true" />
                <el-table-column label="非溯源件名" prop="content.partsName" :show-overflow-tooltip="true" />
                <el-table-column label="类型" prop="content.typeName" :show-overflow-tooltip="true" />
                <el-table-column label="仓库" prop="content.warehouseName" :show-overflow-tooltip="true" />
                <el-table-column label="区域" prop="content.warehouseArea" :show-overflow-tooltip="true" />
                <el-table-column label="数量" prop="num" :show-overflow-tooltip="true" />
                <!-- <el-table-column label="价格" prop="content.price" :show-overflow-tooltip="true" /> -->
                <!-- <el-table-column label="备注" prop="content.partsDescription" :show-overflow-tooltip="true" /> -->
              </el-table>
            </div>
            <!-- ****************** 出库审核 ****************** -->
            <div v-if="auditFormData.tenantId == '出库审核'">
              <!-- ********** 原材料 ********* -->
              <el-table :data="outBonudTableData" style="width: 100%" class="mt20" v-if="contentType == 0"
                :header-cell-style="{ background: '#f5f7fa' }" border max-height="240">
                <el-table-column label="编号" prop="content.rawMaterialId" :show-overflow-tooltip="true" />
                <el-table-column label="名称" prop="content.rawMaterialName" :show-overflow-tooltip="true" />
                <el-table-column label="类型" prop="content.typeName" :show-overflow-tooltip="true" />
                <el-table-column label="仓库" prop="content.warehouseName" :show-overflow-tooltip="true" />
                <el-table-column label="区域" prop="content.warehouseArea" :show-overflow-tooltip="true" />
                <el-table-column label="出库数量" prop="num" :show-overflow-tooltip="true" min-width="90" />
                <!-- <el-table-column label="备注" prop="content.rawMaterialDescription"
                                    :show-overflow-tooltip="true" /> -->
              </el-table>
              <!-- ********** 溯源件 ********* -->
              <el-table :data="outBonudTableData" style="width: 100%" class="mt20" v-else-if="contentType == 1"
                :header-cell-style="{ background: '#f5f7fa' }" border max-height="240">
                <el-table-column label="编号" prop="content.fittingId" :show-overflow-tooltip="true" />
                <el-table-column label="溯源件" prop="content.fittingName" :show-overflow-tooltip="true" />
                <el-table-column label="仓库" prop="content.warehouseName" :show-overflow-tooltip="true" />
                <el-table-column label="区域" prop="content.warehouseArea" :show-overflow-tooltip="true" />
                <el-table-column label="品牌" prop="content.brand" :show-overflow-tooltip="true" />
                <el-table-column label="车系" prop="content.series" :show-overflow-tooltip="true" />
                <el-table-column label="车型" prop="content.modelName" :show-overflow-tooltip="true" />
                <!-- <el-table-column label="备注" prop="content.fittingDescription"
                                    :show-overflow-tooltip="true" /> -->
              </el-table>
              <!-- ********** 危固废 ********* -->
              <el-table :data="outBonudTableData" style="width: 100%" class="mt20" v-else-if="contentType == 2"
                :header-cell-style="{ background: '#f5f7fa' }" border max-height="240">
                <el-table-column label="编号" prop="content.hazardousWasteId" :show-overflow-tooltip="true" />
                <el-table-column label="名称" prop="content.hazardousWasteName" :show-overflow-tooltip="true" />
                <el-table-column label="类型" prop="content.typeName" :show-overflow-tooltip="true" />
                <el-table-column label="仓库" prop="content.warehouseName" :show-overflow-tooltip="true" />
                <el-table-column label="区域" prop="content.warehouseArea" :show-overflow-tooltip="true" />
                <el-table-column label="数量" prop="num" :show-overflow-tooltip="true" />
                <!-- <el-table-column label="备注" prop="content.remark" :show-overflow-tooltip="true" /> -->
              </el-table>
              <!-- ********** 非溯源件 ********* -->
              <el-table :data="outBonudTableData" style="width: 100%" class="mt20" v-else
                :header-cell-style="{ background: '#f5f7fa' }" border max-height="240">
                <el-table-column label="编号" prop="content.partsId" :show-overflow-tooltip="true" />
                <el-table-column label="非溯源件名" prop="content.partsName" :show-overflow-tooltip="true" />
                <el-table-column label="类型" prop="content.typeName" :show-overflow-tooltip="true" />
                <el-table-column label="仓库" prop="content.warehouseName" :show-overflow-tooltip="true" />
                <el-table-column label="区域" prop="content.warehouseArea" :show-overflow-tooltip="true" />
                <el-table-column label="数量" prop="num" :show-overflow-tooltip="true" />
                <!-- <el-table-column label="价格" prop="content.price" :show-overflow-tooltip="true" /> -->
                <!-- <el-table-column label="备注" prop="content.partsDescription" :show-overflow-tooltip="true" /> -->
              </el-table>
            </div>
            <!-- ****************** 调拨审核 ****************** -->
            <div v-if="auditFormData.tenantId == '调拨审核'">
              <!-- ********** 原材料 ********* -->
              <el-form :model="allotFormData" label-width="100px" style="padding-top: 40px" label-position="left"
                v-if="contentType == 0">
                <el-form-item label="调拨编号：">
                  <el-text>{{ allotFormData.transferId }}</el-text>
                </el-form-item>
                <el-form-item label="调出仓库：">
                  <el-text>{{ allotFormData.outWarehouse }}</el-text>
                </el-form-item>
                <el-form-item label="材料类型：">
                  <el-text>{{ allotFormData.type_name }}</el-text>
                </el-form-item>
                <el-form-item label="材料类型：">
                  <el-text>{{ allotFormData.type_name }}</el-text>
                </el-form-item>
                <el-form-item label="调入仓库：">
                  <el-text>{{ allotFormData.inWarehouse }}</el-text>
                </el-form-item>
                <el-form-item label="调拨数量：">
                  <el-text>{{ allotFormData.num }}</el-text>
                </el-form-item>
              </el-form>
              <!-- ********** 溯源件 ********* -->
              <el-form :model="allotFormData" label-width="100px" labe-position="left" class="df fww jcsb"
                label-position="left" v-if="contentType == 1">
                <el-form-item label="调拨编号：" style="width: 50%" class="df aic jcsb">
                  <el-text>{{ allotFormData.transferId }}</el-text>
                </el-form-item>
                <el-form-item label="调出仓库：" style="width: 50%" class="df aic jcsb">
                  <el-text>{{ allotFormData.outWarehouse }}</el-text>
                </el-form-item>
                <el-form-item label="调入仓库：" style="width: 50%" class="df aic jcsb">
                  <el-text>{{ allotFormData.inWarehouse }}</el-text>
                </el-form-item>
              </el-form>
              <el-table v-else-if="contentType == 1" :data="recordsTableData" size="small" style="width: 100%"
                :header-cell-style="{ background: '#ebeef5' }" border>
                <el-table-column label="配件编号" prop="fittingId" show-overflow-tooltip />
                <el-table-column label="配件名称" prop="fittingName" show-overflow-tooltip />
                <el-table-column label="品牌" prop="brand" show-overflow-tooltip />
                <el-table-column label="车型" prop="modelName" show-overflow-tooltip />
                <el-table-column label="车系" prop="series" show-overflow-tooltip />
                <el-table-column label="仓库位置" prop="warehouseArea" show-overflow-tooltip />
              </el-table>
              <!-- ********** 危固废 ********* -->
              <el-form :model="allotFormData" label-width="100px" style="padding-top: 40px" label-position="left"
                v-else-if="contentType == 2">
                <el-form-item label="调拨编号：">
                  <el-text>{{ allotFormData.transferId }}</el-text>
                </el-form-item>
                <el-form-item label="调拨类型：">
                  <el-text>{{ allotFormData.type_name }}</el-text>
                </el-form-item>
                <el-form-item label="调出仓库：">
                  <el-text>{{ allotFormData.outWarehouse }}</el-text>
                </el-form-item>
                <el-form-item label="调入仓库：">
                  <el-text>{{ allotFormData.inWarehouse }}</el-text>
                </el-form-item>
                <el-form-item label="调拨数量：">
                  <el-text>{{ allotFormData.num }}</el-text>
                </el-form-item>
              </el-form>
              <!-- ********** 非溯源件 ********* -->
              <el-form :model="allotFormData" label-width="100px" style="padding-top: 40px" label-position="left"
                v-else-if="contentType == 3">
                <el-form-item label="调拨编号：">
                  <el-text>{{ allotFormData.transferId }}</el-text>
                </el-form-item>
                <el-form-item label="调出仓库：">
                  <el-text>{{ allotFormData.outWarehouse }}</el-text>
                </el-form-item>
                <el-form-item label="调入仓库：">
                  <el-text>{{ allotFormData.inWarehouse }}</el-text>
                </el-form-item>
                <el-form-item label="调拨数量：">
                  <el-text>{{ allotFormData.num }}</el-text>
                </el-form-item>
              </el-form>
            </div>
            <!-- ****************** 结算单审核 ****************** -->
            <div v-if="auditFormData.tenantId == '结算单审核'">
              <el-form :model="settleFormData" label-width="140px" label-position="left">
                <el-form-item label="车牌号：">
                  <el-text>{{ settleFormData.号牌号码 }}</el-text>
                </el-form-item>
                <el-form-item label="车辆净重(kg)：">
                  <el-text>{{ settleFormData.车辆净重 }}</el-text>
                </el-form-item>
                <el-form-item label="订单号：">
                  <el-text>{{ settleFormData.orderSn }}</el-text>
                </el-form-item>
                <el-form-item label="单价(元)：" v-if="misspartsDeductionFlag">
                  <el-text>{{ settleFormData.unitPrice }}</el-text>
                </el-form-item>
                <el-form-item label="扣杂系数：" v-if="misspartsDeductionFlag">
                  <el-text>{{ settleFormData.扣杂系数 }}</el-text>
                </el-form-item>
                <el-form-item label="缺件扣款(元)：" v-if="misspartsDeductionFlag">
                  <el-text>{{ settleFormData.missingPartsDeducted }}</el-text>
                </el-form-item>
                <el-form-item label="溢价金额(元)：" v-if="misspartsDeductionFlag">
                  <el-text>{{ settleFormData.premium }}</el-text>
                </el-form-item>
                <el-form-item label="运费补贴(元)：" v-if="misspartsDeductionFlag">
                  <el-text>{{ settleFormData.primage }}</el-text>
                </el-form-item>
                <el-form-item label="税率(‰)：">
                  <el-text>{{ settleFormData.taxRate }}</el-text>
                </el-form-item>
                <el-form-item label="预扣个税(元)：">
                  <el-text>{{ settleFormData.tax }}</el-text>
                </el-form-item>
                <el-form-item label="一口价(元)：" v-if="!misspartsDeductionFlag">
                  <el-text>{{ settleFormData.price }}</el-text>
                </el-form-item>
                <el-form-item label="价款合计(元)：" v-if="misspartsDeductionFlag">
                  <el-text>{{ settleFormData.price }}</el-text>
                </el-form-item>
                <el-form-item label="最终结算价(元)：" v-if="misspartsDeductionFlag">
                  <el-text>{{ settleFormData.finalPrice }}</el-text>
                </el-form-item>
                <el-form-item label="收款人：">
                  <el-text>{{ settleFormData.收款人 }}</el-text>
                </el-form-item>
              </el-form>
            </div>
            <!-- ****************** 财务结算审核 ****************** -->
            <div v-if="auditFormData.tenantId == '财务结算审核'">
              <el-form :model="settleFormData" label-width="140px" label-position="left">
                <el-form-item label="车牌号：">
                  <el-text>{{ settleFormData.号牌号码 }}</el-text>
                </el-form-item>
                <el-form-item label="车辆净重(kg)：">
                  <el-text>{{ settleFormData.车辆净重 }}</el-text>
                </el-form-item>
                <el-form-item label="订单号：">
                  <el-text>{{ settleFormData.orderSn }}</el-text>
                </el-form-item>
                <el-form-item label="单价(元)：" v-if="misspartsDeductionFlag">
                  <el-text>{{ settleFormData.unitPrice }}</el-text>
                </el-form-item>
                <el-form-item label="扣杂系数：" v-if="misspartsDeductionFlag">
                  <el-text>{{ settleFormData.扣杂系数 }}</el-text>
                </el-form-item>
                <el-form-item label="缺件扣款(元)：" v-if="misspartsDeductionFlag">
                  <el-text>{{ settleFormData.missingPartsDeducted }}</el-text>
                </el-form-item>
                <el-form-item label="溢价金额(元)：" v-if="misspartsDeductionFlag">
                  <el-text>{{ settleFormData.premium }}</el-text>
                </el-form-item>
                <el-form-item label="运费补贴(元)：" v-if="misspartsDeductionFlag">
                  <el-text>{{ settleFormData.primage }}</el-text>
                </el-form-item>
                <el-form-item label="税率(‰)：">
                  <el-text>{{ settleFormData.taxRate }}</el-text>
                </el-form-item>
                <el-form-item label="预扣个税(元)：">
                  <el-text>{{ settleFormData.tax }}</el-text>
                </el-form-item>
                <el-form-item label="一口价(元)：" v-if="!misspartsDeductionFlag">
                  <el-text>{{ settleFormData.price }}</el-text>
                </el-form-item>
                <el-form-item label="价款合计(元)：" v-if="misspartsDeductionFlag">
                  <el-text>{{ settleFormData.price }}</el-text>
                </el-form-item>
                <el-form-item label="最终结算价(元)：" v-if="misspartsDeductionFlag">
                  <el-text>{{ settleFormData.finalPrice }}</el-text>
                </el-form-item>
                <el-form-item label="收款人：">
                  <el-text>{{ settleFormData.收款人 }}</el-text>
                </el-form-item>
              </el-form>
            </div>
            <!-- ****************** 司机申述 ****************** -->
            <!-- <div v-if="auditFormData.tenantId == '司机申述'">
                            <el-table :data="auditDetailData" style="width: 100%" class="mt20"
                                :header-cell-style="{ 'background': '#f5f7fa' }" border max-height="240">
                                <el-table-column label="序号" prop="updatedAt" :show-overflow-tooltip="true" />
                                <el-table-column label="司机申述" prop="warehouseName" :show-overflow-tooltip="true" />
                            </el-table>
                        </div> -->
            <!-- ****************************** 审核流程 ****************************** -->
            <div style="margin-top: 30px">
              <div class="df aic">
                <div class="black_box">{{ PutInName }}</div>
                <div>
                  <p>{{ PutInName }}&nbsp;&nbsp;&nbsp;发起</p>
                  <p style="font-size: 12px; color: #999; margin-top: 4px" v-if="contentType == 0">原材料</p>
                  <p style="font-size: 12px; color: #999; margin-top: 4px" v-else-if="contentType == 1">溯源件</p>
                  <p style="font-size: 12px; color: #999; margin-top: 4px" v-else-if="contentType == 2">危固废</p>
                  <p style="font-size: 12px; color: #999; margin-top: 4px" v-else-if="contentType == 4">非溯源件</p>
                </div>
              </div>
              <div class="black_b" style="height: 60px">
                <div style="width: 2px; height: 40px; background-color: #eee"></div>
              </div>
              <!-- 审批人 -->
              <div v-for="(item, index) in carbonArr" :key="index">
                <div class="df aic">
                  <div class="black_box">{{ item.执行人 }}</div>
                  <div class="df aic">
                    <div>
                      <p>{{ item.执行人 }}</p>
                      <p style="font-size: 12px; color: #999; margin-top: 4px">{{ item.任务名 }}</p>
                    </div>
                    <img v-if="item.签名" style="width: 100px; height: 38px" class="ml20" :src="item.签名" alt="" />
                  </div>
                </div>
                <div class="black_b" style="height: 30px">
                  <div style="width: 2px; height: 30px; background-color: #409ffa"></div>
                </div>
              </div>
              <div class="df aic">
                <div class="black_box">抄</div>
                <div>
                  <p>抄送人</p>
                  <p style="font-size: 12px; color: #999; margin-top: 4px">已抄送 {{ approverLength }} 人</p>
                </div>
              </div>
              <div class="df">
                <div style="width: 50px"></div>
                <div class="df aic mt10">
                  <div style="text-align: center; margin-right: 6px" class="df fww fdc aic" v-for="item in approverArr"
                    :key="item">
                    <div class="black_boxx">{{ item }}</div>
                    <p style="font-size: 12px; color: #999; font-weight: 200; margin-top: 4px">{{ item }}</p>
                  </div>
                </div>
              </div>
            </div>

            <template #footer>
              <el-button type="primary" plain @click="checkcenterDialogVisible1 = false">取消</el-button>
            </template>
          </el-drawer>
        </el-tab-pane>
      </el-tabs>
    </div>
    <!-- ########################### 拒绝审核 ###########################-->
    <el-dialog class="dialog" v-model="rejectCenterDialogVisible" width="40%" align-center>
      <template #header>
        <div class="df aic">
          <el-icon style="color: #fff" size="20">
            <Edit />
          </el-icon>&nbsp;
          <p style="color: #fff">拒绝审核</p>
        </div>
      </template>
      <el-form :model="rejectData" label-width="120" label-position="left" class="df fww aic jcc">
        <el-form-item label="任务名：" style="width: 60%">
          <el-input v-model="rejectData.任务名" placeholder="任务名：" disabled />
        </el-form-item>
        <el-form-item label="任务类型：" style="width: 60%">
          <el-input v-model="rejectData.任务类型" placeholder="任务类型：" disabled />
        </el-form-item>
        <el-form-item label="拒绝原因：" style="width: 60%">
          <el-input v-model="rejectData.reason" type="textarea" placeholder="拒绝原因：" />
        </el-form-item>
      </el-form>

      <template #footer>
        <el-button type="primary" plain @click="rejectCenterDialogVisible = false">取消</el-button>
        <el-button type="primary" @click="rejectSubmit">&nbsp;提交&nbsp;</el-button>
      </template>
    </el-dialog>
    <!-- ########################### 预览 ###########################-->
    <div class="previewImgDialog">
      <el-dialog class="dialog" v-model="previewImgDialog" width="40%" align-center>
        <img style="width: 100%; height: 100%" :src="transportBill" alt="" />
      </el-dialog>
    </div>
  </div>
</template>

<script setup lang="ts">
import { ElMessage } from 'element-plus';
import { Wallet, Edit } from '@element-plus/icons-vue';
import { formatTimeAll } from '@/filters/index';
import {
  RequestActivitFinishMyMission,
  RequestActivitiGetPersonTask,
  RequestActivitiRejectTask,
  RequestActivitiGetTaskDetail,
  RequestCodeDeployGetDefinedProcess,
  RequestActivitiGetHistoryTask,
  RequestActivitFinishMyMissionnew,
} from '@/api/path/index.js';
import { ref } from 'vue';
import useAuthorize from '@/hooks/authorize';
let roleList = useAuthorize();
const activeName = ref('first');
// const activeName = ref('-1')
const loading = ref<any>(false);
const tableData = ref<any>([]);
const checkFormData = ref<any>({});
const centerDialogVisible = ref<any>(false);
const checkcenterDialogVisible = ref<any>(false); //详情
const checkcenterDialogVisible1 = ref<any>(false); //详情
const rejectCenterDialogVisible = ref<any>(false); //详情
const previewImgDialog = ref<any>(false); //详情
const total = ref<any>(8);
const currentPage = ref(1);
const pageSize = ref(10);
const recordsTableData = ref([]);

const previewImg = () => {
  previewImgDialog.value = true;
};
/* ************************ 分页获取数据 ************************ */
const getData = () => {
  RequestActivitiGetPersonTask(
    JSON.parse(localStorage.getItem('roleInfo')!).id,
    currentPage.value,
    pageSize.value,
  ).then((res: any) => {
    res.resultObj.data.forEach((item: any) => {
      item.发起时间 = formatTimeAll(item.发起时间);
    });
    tableData.value = res.resultObj.data;
    total.value = res.resultObj.total;
  });
};
getData();
const handleSizeChange = (val: number) => {
  getData();
};
const handleCurrentChange = (val: number) => {
  getData();
};
/* ************************ 查看详情 ************************ */
const checkDataList = (row: any) => {
  checkFormData.value = row;
  centerDialogVisible.value = true;
};
/* ************************ 审核 ************************ */
const transportBill = ref<any>(); //危固废转运联单
const auditFormData = ref<any>({});
const putIntableData = ref<any>([]); //入库审核详情数据
const outBonudTableData = ref<any>([]); //入库审核详情数据
const allotFormData = ref<any>([]); //调拨审核详情数据
const settleFormData = ref<any>([]); //结算单详情数据
const contentType = ref<any>();
const taskId = ref<any>('');
const PutInName = ref<any>(); //入库人&发起人
const approverArr = ref<any>([]); //抄送人
const carbonArr = ref<any>([]); //审批人
const approverLength = ref<any>(); //审批人
const rejectData = ref<any>({}); //拒绝数据
const misspartsDeductionFlag = ref<any>(false); //判断一口价还是缺件的
const auditData = (row: any) => {
  taskId.value = row.任务id;
  auditFormData.value = row;
  rejectData.value = row;
  // console.log(auditFormData.value);
  RequestActivitiGetTaskDetail(row.任务类型, row.businessKey).then((res: any) => {
    if (res.success == true) {
      if (auditFormData.value.任务类型 == '入库审核') {
        putIntableData.value = res.resultObj.data;
        contentType.value = putIntableData.value[0].contentType;
        PutInName.value = res.resultObj.发起人;
      } else if (auditFormData.value.任务类型 == '出库审核') {
        console.log(' res.resultObj.data', res.resultObj);
        outBonudTableData.value = res.resultObj.data;
        contentType.value = outBonudTableData.value[0].contentType;
        transportBill.value = res.resultObj.transportBill;
        PutInName.value = res.resultObj.发起人;
      } else if (auditFormData.value.任务类型 == '调拨审核') {
        allotFormData.value = res.resultObj;
        recordsTableData.value = res.resultObj.fittings;
        contentType.value = res.resultObj.contentType;
        PutInName.value = res.resultObj.发起人;
      } else if (auditFormData.value.任务类型 == '结算单审核') {
        if (res.resultObj.缺件扣款 == res.resultObj.missingPartsDeducted) {
          misspartsDeductionFlag.value = true;
        } else {
          misspartsDeductionFlag.value = false;
        }
        settleFormData.value = res.resultObj;
        console.log('settleFormData.value', settleFormData.value);
        // contentType.value = 4
        PutInName.value = res.resultObj.发起人;
      } else if (auditFormData.value.任务类型 == '财务结算审核') {
        if (res.resultObj.缺件扣款 == res.resultObj.missingPartsDeducted) {
          misspartsDeductionFlag.value = true;
        } else {
          misspartsDeductionFlag.value = false;
        }
        settleFormData.value = res.resultObj;
        console.log('settleFormData.value', settleFormData.value);
        // contentType.value = 4
        PutInName.value = res.resultObj.发起人;
      }
    } else {
      ElMessage.error(res.msg);
    }
  });
  RequestCodeDeployGetDefinedProcess(row.任务id).then((res: any) => {
    console.log('res.resultObj', res.resultObj);
    carbonArr.value = res.resultObj;
    approverArr.value = res.resultObj.pop().抄送人;
    // carbonArr.value.forEach((item: any) => {
    //     item.nameFirst = item.执行人.charAt(0)
    // });
    approverLength.value = approverArr.value.length;
  });
  checkcenterDialogVisible.value = true;
};
const closeDialog = () => {
  auditFormData.value = {};
  putIntableData.value = [];
  outBonudTableData.value = [];
  contentType.value = null;
  PutInName.value = null;
  approverArr.value = [];
  carbonArr.value = [];
  approverLength.value = null;
};
/* ************************ 提交审核 ************************ */
const submitAudit = () => {
  // loading.value = true
  let sign = JSON.parse(localStorage.getItem('roleInfo')!).sign;
  if (sign == null) {
    RequestActivitFinishMyMission(taskId.value).then((res: any) => {
      if (res.success == true) {
        getData();
        ElMessage.success(res.msg);
        loading.value = false;
        checkcenterDialogVisible.value = false;
      }
    });
  } else {
    RequestActivitFinishMyMissionnew({
      taskId: taskId.value,
      employeeId: JSON.parse(localStorage.getItem('roleInfo')!).id,
      signPhoto: sign,
    }).then((res: any) => {
      if (res.success == true) {
        getData();
        ElMessage.success(res.msg);
        loading.value = false;
        checkcenterDialogVisible.value = false;
      }
    });
  }
};
const total1 = ref<any>(8);
const currentPage1 = ref(1);
const pageSize1 = ref(10);
/* ************************ 审核不通过 ************************ */

const rejectAudit = () => {
  rejectCenterDialogVisible.value = true;
};
const rejectSubmit = () => {
  if (rejectData.value.reason == undefined) {
    ElMessage.error('请填写拒绝原因');
  } else {
    RequestActivitiRejectTask({
      taskId: rejectData.value.任务id,
      companyNode: JSON.parse(localStorage.getItem('roleInfo')!).company,
      employeeId: JSON.parse(localStorage.getItem('roleInfo')!).id,
      reason: rejectData.value.reason,
    }).then((res: any) => {
      if (res.success == true) {
        getData();
        ElMessage.success(res.msg);
        // loading.value = false
        rejectCenterDialogVisible.value = false;
        checkcenterDialogVisible.value = false;
      } else {
        ElMessage.error(res.msg);
      }
    });
  }
};
/* ************************ 分页获取数据 ************************ */
const getOriData = () => {
  RequestActivitiGetHistoryTask(
    JSON.parse(localStorage.getItem('roleInfo')!).id,
    currentPage1.value,
    pageSize1.value,
  ).then((res: any) => {
    tableData.value = res.resultObj.data;
    total1.value = res.resultObj.total;
  });
};
const handleSizeChange1 = (val: number) => {
  getOriData();
};
const handleCurrentChange1 = (val: number) => {
  getOriData();
};
const handleClick = (event: any) => {
  if (event.props.name == 'first') {
    getData();
  } else {
    getOriData();
  }
};
const auditResult = ref<any>({});
const auditData1 = (row: any) => {
  auditFormData.value = row;
  console.log(auditFormData.value);
  RequestActivitiGetTaskDetail(row.tenantId, row.businessKey).then((res: any) => {
    auditResult.value = res.resultObj.审核结果;
    PutInName.value = res.resultObj.发起人;
    if (auditFormData.value.tenantId == '入库审核') {
      putIntableData.value = res.resultObj.data;
      contentType.value = putIntableData.value[0].contentType;
    } else if (auditFormData.value.tenantId == '出库审核') {
      outBonudTableData.value = res.resultObj.data;
      contentType.value = outBonudTableData.value[0].contentType;
      transportBill.value = res.resultObj.transportBill;
    } else if (auditFormData.value.tenantId == '调拨审核') {
      allotFormData.value = res.resultObj;
      contentType.value = res.resultObj.contentType;
    } else if (auditFormData.value.tenantId == '结算单审核') {
      console.log('settleFormData.value ', res.resultObj);
      if (res.resultObj.缺件扣款 == res.resultObj.missingPartsDeducted) {
        misspartsDeductionFlag.value = true;
      } else {
        misspartsDeductionFlag.value = false;
      }
      settleFormData.value = res.resultObj;
      // contentType.value = res.resultObj.contentType
    } else if (auditFormData.value.tenantId == '财务结算审核') {
      console.log('settleFormData.value ', res.resultObj);
      if (res.resultObj.缺件扣款 == res.resultObj.missingPartsDeducted) {
        misspartsDeductionFlag.value = true;
      } else {
        misspartsDeductionFlag.value = false;
      }
      settleFormData.value = res.resultObj;
      // contentType.value = res.resultObj.contentType
    }
  });
  RequestCodeDeployGetDefinedProcess(row.id).then((res: any) => {
    carbonArr.value = res.resultObj;
    approverArr.value = res.resultObj.pop().抄送人;
    approverLength.value = approverArr.value.length;
  });
  checkcenterDialogVisible1.value = true;
};
</script>

<style scoped lang="scss">
.black_box {
  width: 40px;
  height: 40px;
  color: #fff;
  font-size: 20px;
  text-align: center;
  line-height: 40px;
  border-radius: 8px;
  background-color: #449efe;
  margin-right: 16px;
}

.black_boxx {
  width: 30px;
  height: 30px;
  color: #fff;
  font-size: 14px;
  text-align: center;
  line-height: 30px;
  border-radius: 6px;
  background-color: #449efe;
}

.black_b {
  width: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.main {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  .top {
    width: 100%;
    background-color: #fff;
  }

  .content {
    width: 100%;
    background-color: #fff;
  }
}

.id {
  font-size: 14px;
  color: #b2b2b2;
  display: inline-block;
  width: 50%;
  /* 限制容器宽度 */
  white-space: nowrap;
  /* 不换行 */
  overflow: hidden;
  /* 隐藏溢出部分 */
  text-overflow: ellipsis;
  /* 显示省略号 */
}

.icon_i {
  position: absolute;
  top: 0;
  bottom: 0;
  left: -6.875rem;
  right: 0;
  margin: auto 0;
}

.downLoad {
  line-height: 1rem;
  margin-left: 0.625rem;
  color: #116cf8;
}

.el-select {
  width: 100%;
}

.el-input-number {
  width: 100%;
}

.drawer_top {
  width: 100%;
  background-color: #fff;
  border-radius: 0.5rem;
}

/* 弹出框样式 */
::v-deep .el-overlay {
  .el-dialog__header {
    background-color: #116cf8;
    margin-right: 0;

    .el-icon svg {
      color: #fff;
    }
  }

  .el-dialog__title {
    color: #fff;
  }

  .el-button {
    .el-icon svg {
      color: #116cf8;
    }
  }
}

::v-deep .el-drawer {
  .el-overlay .el-icon svg {
    color: red;
  }

  .el-drawer__header {
    margin-bottom: 0;
  }
}

.DocumentNumber {
  .el-button {
    background-color: #fff;
    border: 0.0625rem solid #dcdfe6;
    border-left: none;
  }
}

.drawer_bottom {
  width: 100%;
  height: 10%;
  background-color: #fff;
  padding: 1.25rem;
  position: absolute;
  bottom: 0;
  right: 0;
}

/* 上传框 */
.upload {
  width: 7.625rem;
  height: 7.625rem;
  border-radius: 0.375rem;
  background-color: #fafafa;
  overflow: hidden;
  border: 0.0625rem dashed #cdd0d6;
  position: relative;
}

.upload:hover {
  border: 0.0625rem dashed #116cf8;
  transition: 500ms;

  .add {
    color: #116cf8;
    transition: 500ms;
  }
}

.add {
  font-size: 2.25rem;
  color: #cccccc;
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  bottom: 0;
  margin: auto;
}

::v-deep .el-upload-list__item,
::v-deep .el-upload-list__item-thumbnail,
::v-deep .el-upload {
  width: 7.5rem;
  height: 7.5rem;
}

::v-deep .el-upload {
  opacity: 0;
}

::v-deep.previewImgDialog {
  .el-dialog__header {
    background-color: #fff !important;
  }
}
</style>
